﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _0517病例系统
{
    public partial class frmdrug : Form
    {
        public frmdrug()
        {
            InitializeComponent();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Hide();
        }
         
        private void button1_Click(object sender, EventArgs e)
        {
            yaopin yy = new yaopin();
            yy.Show();

            
        }

        
        private void frmdrug_Load(object sender, EventArgs e)
        {
            this.timer1.Interval = 4000;
            this.timer1.Start();

            string strSql = "";
            DataSet ds;
            strSql = "select * from Yaopinss where 1=1";
            DataAccess data = new DataAccess();
            data.dataCon();
            ds = data.getDataset(strSql);
            this.dataGridView1.DataSource = ds.Tables["Table"];

            
        }

        public static string i;
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                i = dataGridView1.CurrentRow.Cells["编号"].Value.ToString();
            }
            xiugai gg = new xiugai();
            gg.Show();
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
          
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            frmdrug_Load(null, null);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            string strsql;
            DataAccess data = new DataAccess();
            strsql = "delete from Yaopinss where 编号='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'";
            data.dataCon();
            if (data.sqlExec(strsql))
            {
                MessageBox.Show("删除成功！");
            }
            else
            {
                MessageBox.Show("删除失败！");
            }
        }
    }
}
